namespace InfoLogic.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class soffo4 : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.SalesProducts", "Sales_SalesId", "dbo.Sales");
            DropForeignKey("dbo.SalesProducts", "Product_ProductId", "dbo.Product");
            DropIndex("dbo.SalesProducts", new[] { "Sales_SalesId" });
            DropIndex("dbo.SalesProducts", new[] { "Product_ProductId" });
            AddForeignKey("dbo.Sales", "productId", "dbo.Product", "ProductId", cascadeDelete: true);
            CreateIndex("dbo.Sales", "productId");
            DropTable("dbo.SalesProducts");
        }
        
        public override void Down()
        {
            CreateTable(
                "dbo.SalesProducts",
                c => new
                    {
                        Sales_SalesId = c.Guid(nullable: false),
                        Product_ProductId = c.Guid(nullable: false),
                    })
                .PrimaryKey(t => new { t.Sales_SalesId, t.Product_ProductId });
            
            DropIndex("dbo.Sales", new[] { "productId" });
            DropForeignKey("dbo.Sales", "productId", "dbo.Product");
            CreateIndex("dbo.SalesProducts", "Product_ProductId");
            CreateIndex("dbo.SalesProducts", "Sales_SalesId");
            AddForeignKey("dbo.SalesProducts", "Product_ProductId", "dbo.Product", "ProductId", cascadeDelete: true);
            AddForeignKey("dbo.SalesProducts", "Sales_SalesId", "dbo.Sales", "SalesId", cascadeDelete: true);
        }
    }
}
